package com.yjd.bi.comm.vo;

/**
 * BI系统常量
 * Created by yangchangyan@yijiedai.com on 2018/1/12.
 */
public class Constant {
    /**
     * @Description: 系统参数key
     */
    public enum SysParamKeyEnum {

        WEEKLY_REPORT_DOM_STRUCTURE("WEEKLY_REPORT_DOM_STRUCTURE", "运营周报文档结构（JSON）");

        private String key;
        private String description;

        private SysParamKeyEnum(String key, String description) {
            this.key = key;
            this.description = description;
        }

        public String getDescription() {
            return description;
        }

        public String getKey() {
            return key;
        }
    }

    /**
     * 权限控制，每一个位表示一种权限（0：无，1：有），int型4个字节共32位。
     * 右往左每一位对应一种权限
     *
     */
    public enum AuthorityEnum {

        RETRIEVE(1, "查询"),
        CREATE(2, "新增"),
        UPDATE(4, "修改")
        ;

        private int authority;
        private String description;

        private AuthorityEnum(int authority, String description) {
            this.authority = authority;
            this.description = description;
        }

        public int getAuthority() {
            return authority;
        }

        public String getDescription() {
            return description;
        }

        public static AuthorityEnum getByAuthority(int authority){
            for (AuthorityEnum ath : AuthorityEnum.values()) {
                if(ath.getAuthority() == authority){
                    return ath;
                }
            }
            return null;
        }
    }
}
